{% load seahub_tags i18n %}

<!DOCTYPE html>
<html>
<head>
<title>{{doc_title}}</title>
<link rel="icon" href="{{ MEDIA_URL }}{{ favicon_path }}" />
<style type="text/css">
html, body { padding:0; margin:0; height:100%; }
</style>
</head>

<body>

<div id="placeholder"></div>

{% get_current_language as LANGUAGE_CODE %}
<script type="text/javascript" src="{{ ONLYOFFICE_APIJS_URL }}"></script>
<script type="text/javascript">
var config = {
    "document": {
        "fileType": "{{ file_type }}",
        "key": "{{doc_key}}",
        "title": "{{doc_title}}",
        "url": "{{doc_url}}",
        "permissions": {
            "download": true,
            "edit": {% if can_edit %}true{% else %}false{% endif %},
            "print": true,
            "review": true
        },
    },
    "documentType": "{{document_type}}", // 'text' | 'spreadsheet' | 'presentation',
    "editorConfig": {
        "callbackUrl": "{{ callback_url }}",
        "lang": "{{ LANGUAGE_CODE }}",
        "mode": {% if can_edit %}"edit"{% else %}"view"{% endif %},
        "user": {
            "name": "{{ username|email2nickname }}"
        }
    },
};
var docEditor = new DocsAPI.DocEditor("placeholder", config);
</script>
</body>
</html>
